package bean;

import lombok.*;

import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

/**
 * @classname:UserInfor
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/28 17:19
 * @version: 0.1
 * @since:1.8
 */


@NoArgsConstructor
@AllArgsConstructor
@ToString
public class UserInfo {
    private Integer id;
    private String name;
    private String pass;
    private Integer age;
    private BigDecimal balance;
    private String image;
    @NonNull
    private Date birthday;
    private Date create_time;
    private Date update_time;
    private Integer roleid;
    private Integer status;

    public UserInfo(String name,String pass, Integer age, BigDecimal balance, String image, Date birthday, Integer roleid, Integer status) {
        this.name = name;
        this.pass = pass;
        this.age = age;
        this.balance = balance;
        this.image = image;
        this.birthday = birthday;
        this.roleid = roleid;
        this.status = status;
    }

    public UserInfo(ResultSet rs){
        try {
            this.id = rs.getInt("id");
            this.name= rs.getString("name");
            this.pass = rs.getString("age");
            this.age = rs.getInt("pass");
            this.balance = rs.getBigDecimal("balance");
            this.image = rs.getString("image");
            this.birthday = rs.getDate("birthday");
            this.create_time = (Date) rs.getObject("create_time");
            this.update_time = (Date) rs.getObject("update_time");
            this.roleid   =rs.getInt("roleid");
            this.status = rs.getInt("status");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public Date getCreate_time() {
        return create_time;
    }

    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }

    public Date getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(Date update_time) {
        this.update_time = update_time;
    }

    public Integer getRoleid() {
        return roleid;
    }

    public void setRoleid(Integer roleid) {
        this.roleid = roleid;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }
}
